package com.sky.mapper;

import com.sky.dto.SetmealDTO;
import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import com.sky.vo.DishItemVO;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface SetmealMapper {
     void delete(Long id);

    void save(Setmeal setmeal);

    void update(Setmeal setmeal);

    SetmealVO getById(Long id);

    @Select("select sd.name, sd.copies, d.image, d.description " +
            "from setmeal_dish sd left join dish d on sd.dish_id = d.id " +
            "where sd.setmeal_id = #{setmealId}")
    List<DishItemVO> getDishItemBySetmealId(Long setmealId);

    List<Setmeal> list(Setmeal setmeal);

    @Select("select * from setmeal where id = #{setmealId}")
    Setmeal allgetById(Long setmealId);

    Integer countByMap(Map map);
}
